package com.hefei.customer.login.dao.impl;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.hefei.common.returncode.ReturnCode;
import com.hefei.customer.login.dao.ILoginDao;
import com.hefei.customer.login.mapper.LoginMapper;
import com.hefei.customer.login.po.User;
import com.hefei.service.framework.base.request.RequestThreadLocal;
import com.hefei.service.framework.exception.DaoException;
@Repository
public class LoginDao implements ILoginDao {
	
	private static Logger logger = Logger.getLogger(LoginDao.class);
	@Autowired
	private LoginMapper loginMapper;

	@Override
	public User getByNameAndpassword(String username) throws DaoException {
		long begintimer = System.currentTimeMillis();
		User user = new User();
		try {
		
		user =	 loginMapper.getUserByName(username);
			
		return user;
		} catch (Exception e) {
			logger.error(RequestThreadLocal.getLoggerStr() + " error ", e);
			throw new DaoException(ReturnCode.RETURN_CODE_ERROR_DAO);
		}
		
		
	}

}
